NTest
Testing framework for rust which enhances the built-in library with some useful features. Inspired by the .Net unit-testing framework NUnit.
Getting Started
Some functions of NTest use procedural macros which are stable for rust edition 2018. If you use the library make sure that you are using the 2018 version of rust. Update the Cargo.toml file:
[]
= "2018"
# ..
Add the NTest library to your developer dependencies in the Cargo.toml file:
[]
= "*"
Content
#[timeout()]
Attribute used for timeouts in tests.#[test_case()]
Attribute used to define multiple test cases for a test function.assert_about_equal!()
Compare two floating point values or vectors for equality.assert_false!()
Expects false argument for test case.assert_true!()
Expects true argument for test case.assert_panics!()
Expects block to panic. Otherwise the test fails.
For more information read the documentation.
Examples
Create test cases
use test_case;
Timeout for long running functions
use timeout;
Combine attributes
use ;
use timeout;
use test_case;
Changelog
Checkout the changelog file to see the changes between different versions.
License
This project is licensed under the MIT License - see the LICENSE file for details.